Skip to content

Wait for Optimize; switching settings no longer re-runs anything - #21

Merged
farhanmasud merged 1 commit into
stagingfrom
feat/optimize-button
Nov 7, 2026
Merged

farhanmasud merged 1 commit into
stagingfrom
feat/optimize-button

Conversation

@farhanmasud

Copy link
Copy Markdown
Member

Covers three of your four points. (The dropdown colours are in #20.)

Nothing runs until Optimize

  • Dropped images are read and listed (thumbnail, dimensions, size, role) with the status Ready. The toolbar shows Optimize N images.
  • Pressing it while images are still being read includes them once they're read.
  • While it runs, the button reads Optimizing… and a Stop button appears. The settings and per-row roles are locked, so a run never mixes settings.
  • Stop ends the run. Finished images keep their files; the rest go back to Ready.
  • Once everything is made, the same button becomes Download ZIP, with Copy HTML and Save to folder beside it. Being one button, it keeps keyboard focus from Optimize through to Download.

Switching CMS master ↔ Responsive set no longer runs anything

  • Changing the output, role, quality or maximum width only changes what Optimize will make. Images that need new files go back to Ready, and the button counts them.
  • Each image keeps its last finished set per mode. Make CMS masters, switch to Responsive set and optimize, then switch back: the masters reappear at once, with no second run. Toggle as much as you like.
  • Sets are matched on the exact files planned. A change that wouldn't alter them, such as a role with the same widths for that image, keeps the files.

One file by default

  • CMS master is the default and now comes first.
  • The output isn't remembered between visits, so each visit starts on CMS master and you choose before pressing Optimize. Role, quality, maximum width, path, markup and placeholder are still remembered.
  • Before this change the whole settings object was saved, so your browser may hold "Responsive set" from earlier. It's ignored now.

Screens (light, desktop): Ready → Optimizing (settings faded, Stop) → Done (Save to folder, Download ZIP). The phone-width dark layout wraps cleanly. I checked these by screenshot; nothing else moved.

Tests

  • Every e2e test now presses Optimize.
  • New test: nothing runs before Optimize; settings and roles lock while it runs; Stop clears the queue and returns focus to the button; Optimize again finishes the rest, and the same button then downloads.
  • The mode test now checks that switching runs nothing, that Optimize makes the master, and that switching back brings the responsive set back with no progress bar.
  • axe now also runs on the Ready list, in light and dark mode.
  • Merged locally with Send HEIC straight to the browser decoder #19 and Readable dropdown options in dark mode #20: 54 unit and 16 e2e tests pass, with no conflicts.

Your call

  • Remembering the output: I read "the default should be one output" as starting every visit on CMS master. If you'd rather it remember your last choice, that's one line.
  • Locking the settings while it runs, instead of letting a mid-run change apply to the images still queued. Locking keeps a run to one set of settings; Stop is the way out.

Preview: https://feat-optimize-button.image-optimizer-7ba.pages.dev (once CI has deployed it).

🤖 Generated with Claude Code

https://claude.ai/code/session_01STHRjFYWhkJBxSKG3tJdap

Dropped images are now read and listed (thumbnail, size, role) but not made into
anything until Optimize is pressed. Pressing it while images are still being read
includes them once they're read.

- CMS master is the default and comes first. The output isn't remembered between
  visits; the other settings still are.
- Changing the output, role, quality or maximum width runs nothing. Images that
  need new files show "Ready", and Optimize counts them.
- Each image keeps its last finished set per mode. Switching back to settings it
  was made with shows those files again without a second run. Sets are matched on
  the exact variants planned, so a change that wouldn't alter the files (e.g. a
  role with the same widths) keeps them.
- While optimizing, the settings and row roles are locked, and Stop ends the run.
  Finished images keep their files; the rest go back to ready.
- One button carries the next step, Optimize and then Download ZIP. It uses
  aria-disabled while busy, so focus stays on it. Copy and Save to folder appear
  once everything is made with the current settings.

The e2e tests press Optimize. A new test covers waiting, locking, Stop and resuming,
and the mode test checks that switching back needs no second run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01STHRjFYWhkJBxSKG3tJdap
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying image-optimizer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 35325ce
Status: ✅  Deploy successful!
Preview URL: https://cddf77a3.image-optimizer-7ba.pages.dev
Branch Preview URL: https://feat-optimize-button.image-optimizer-7ba.pages.dev

View logs

@farhanmasud
farhanmasud merged commit be5f7e3 into staging Nov 7, 2026
2 checks passed
@farhanmasud
farhanmasud deleted the feat/optimize-button branch November 7, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant